export default {
		install(Vue){
		let tpl;
        // 弹出框
        Vue.prototype.loading = () =>{
            var loading = Vue.extend(require('./src/loading.vue').default);
            tpl = new loading().$mount().$el;  // 2、创建实例，挂载到文档以后的地方
            document.body.appendChild(tpl);  
            return tpl
        }
        Vue.mixin({
        	methods: {
        		hideLoading: function () {
              if(tpl) document.body.removeChild(tpl);
        		}
        	}
        })
    }
}
/*import Vue from 'vue';
const Loading = Vue.extend(require('./src/loading.vue'));
let instance;
export default {
  loading(options = {}) {
    if (!instance) {
      instance = new Loading({
        el: document.createElement('div')
      });
    }
    // if (instance.visible) return;
    instance.text = typeof options === 'string' ? options : options.text || '';
    instance.spinnerType = options.spinnerType || 'snake';
    //document.body.appendChild(instance.$el);

    Vue.nextTick(() => {
      instance.visible = true;
    });
  },
  close() {
    if (instance) {
      instance.visible = false;
    }
  }
}*/

